Ex002, Label and Edit box
Label used to display fixed titles at form or can be used to display results.
Edit box used to enter data, such as user name and age.
Label and Edit box exists in Standard page of Component palette.
Exercise 2: Label and Edit box
1. Drop a label.
2. Point on Label1 and press F11 to display Object inspector.
3. At lable's Name property write 'laName'.
4. Drop an Edit box and position it below above label.
5. Point on Edit1 and press F11 to display Object inspector.
6. At edit's Name property write 'edName', clear Text property contents.
7. Drop another label and position it at the left side of edit box.
8. At new label's Caption write 'Enter your name'.
9. Point at edName. At object inspector/events double click on OnChange event and
write this code:
laName.Caption:= edName.Text;
10. Drop a button, in it's caption write 'E&xit'.
11. On button's OnClick event write:
Close;
12. Press F9 to run application and type your name at Edit box.
13. Click Exit button to close application.